package pt.utl.ist.project_ccu.android_libs;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import android.graphics.Bitmap;

public class Photo implements Serializable {
	
	static final long serialVersionUID = 42L;
	
	private String _photoURI;
	private String _name;
	private int _photoID;
	List<Tag> _tags = new ArrayList<Tag>();
	
	public Photo(String photoURI){
		_photoURI = photoURI;
	}
	
	public Photo(String photoURI, Tag tag){
		_photoURI = photoURI;
		_tags.add(tag);
	}
	public Photo(int id){
		_photoID = id;
		_name = "";
	}
	
	public String getUri() {
		return _photoURI;
	}
	
	//Adicionar Tag a foto
	public void addTag(Tag tag){
		_tags.add(tag);
	}
	
	//Remoover Tag a foto
	public void removeTag(Tag tag){
		_tags.remove(tag);
	}
	
	public int getId() {
		return _photoID;
	}
	
	public boolean hasTags(List<Tag> tags) {
		return _tags.equals(tags);
	}
	
	public List<Tag> getTags() {
		return  _tags;
	}
	
	public String getName() {
		return _name;
	}
	
	public void setName(String name) {
		_name = name;
	}
	
	@Override
	public boolean equals(Object other){
	    if (other == null) return false;
	    if (other instanceof Photo) {
	    	return ((Photo) other).getTags().equals(_tags)
	    			&& ((Photo) other).getId() == _photoID;
	    }
	    return false;
	}
}
